<?php 
$informtable = "
	<table  cellspacing='0' border = '1px' >
	<tr >
		<td>UserID</td>
		<td>FirstName</td>
		<td>LastName</td>
		<td>Loghin</td>
		<td>Password</td>
		<td>RoleType</td>
		<td>PasswordStatus</td>
		<td>RecordStatus</td>
		<td>EditUserID</td>
		<td>EditDate</td>
		<td>Action</td>
	</tr>";

	$resultmessage = mysql_query("SELECT * FROM USERS" );
	while ($message = mysql_fetch_array($resultmessage))
	{
		$UserID =  $message["UserID"];
		$FirstName = $message["FirstName"]; if ($FirstName == "") {$FirstName = "&nbsp;";}
		$LastName = $message["LastName"];if ($LastName == "") {$LastName = "&nbsp;";}
		$Loghin = $message["Loghin"];if ($Loghin == "") {$Loghin = "&nbsp;";}
		$Password = $message["Password"];if ($Password == "") {$Password = "&nbsp;";}
		$RoleType = $message["RoleType"];if ($RoleType == "") {$RoleType = "&nbsp;";}
		$PasswordStatus = $message["PasswordStatus"];if ($PasswordStatus == "") {$PasswordStatus = "&nbsp;";}
		$RecordStatus = $message["RecordStatus"];if ($RecordStatus == "") {$RecordStatus = "&nbsp;";}
		$EditUserID = $message["EditUserID"];if ($EditUserID == "") {$EditUserID = "&nbsp;";}
		$EditDate = $message["EditDate"];if ($EditDate == "") {$EditDate = "&nbsp;";}
	
	$informtable = $informtable."
		<tr>
			<td>$UserID </td>
			<td>$FirstName </td>
			<td>$LastName </td>
			<td>$Loghin </td>
			<td>$Password </td>
			<td>$RoleType </td>
			<td>$PasswordStatus</td>
			<td>$RecordStatus </td>
			<td>$EditUserID </td>
			<td>$EditDate </td>
			<td><a href = '$target?deleteUser=$UserID' onclick = \"return confirm('Are you sure?');\"> Delete </a></td>
		</tr>";
	} 

$informtable = $informtable." </table>";

$userRole_resultmessage = mysql_query("SELECT * FROM Classifiers Where TypeID = (select TypeID from ClassifierType Where Name ='Site Role Type') " );																	
	//create combo box
	$userRoleType_cbox = "<select name='addUser_RoleType'>";

	while ($statusPayment_var_message = mysql_fetch_array($userRole_resultmessage))
		{	
			$statusPay_Code = $statusPayment_var_message["Code"];
			$statusPay_Name = $statusPayment_var_message["Name"];	
			if ($status_pay == $statusPay_Code)	
			{ $userRoleType_cbox.="<option value='".$statusPay_Code."' selected = 'selected' >".$statusPay_Name."</option>"; }
			else
			{ $userRoleType_cbox.="<option value='".$statusPay_Code."' >".$statusPay_Name."</option>"; }
		}
		$userRoleType_cbox.= "</select>";

		
		
	$interfaceLanguage_resultmessage = mysql_query("SELECT * FROM Classifiers Where TypeID = (select TypeID from ClassifierType Where Name ='Interface Language') " );																	
	//create combo box
	$userInterfaceLanguage_cbox = "<select name='add_user_InterfaceLanguage'>";

	while ($statusPayment_var_message = mysql_fetch_array($interfaceLanguage_resultmessage))
		{	
			$statusPay_Code = $statusPayment_var_message["Code"];
			$statusPay_Name = $statusPayment_var_message["Name"];	
			if ($status_pay == $statusPay_Code)	
			{ $userInterfaceLanguage_cbox.="<option value='".$statusPay_Code."' selected = 'selected' >".$statusPay_Name."</option>"; }
			else
			{ $userInterfaceLanguage_cbox.="<option value='".$statusPay_Code."' >".$statusPay_Name."</option>"; }
		}
		$userInterfaceLanguage_cbox.= "</select>";	
		

$addNewUserForm =  "<form name='AddNewUserForm' action=$target method='post' >
						<table cellspacing='0' border = '1px' >
							<tr>
								<td>FirstName</td>
								<td>LastName</td>
								<td>Loghin</td>
								<td>Password</td>
								<td>RoleType</td>
								<td>Interface Language</td>
								<td>PasswordStatus</td>
								<td>RecordStatus</td>
							</tr>
							
							<tr >
								<td> <input type='text' name='add_user_FirstName'> </td>	
								<td> <input type='text' name='add_user_LastName'> </td>
								<td> <input type='text' name='add_user_Loghin'>  </td>					
								<td> <input type='text' name='add_user_Password'>  </td>
								<td> $userRoleType_cbox </td>
								<td> $userInterfaceLanguage_cbox  </td>
								<td> <input type='checkbox' name='add_user_PasswordStatus' value='true'> </td>
								<td> <input type='checkbox' name='add_user_RecordStatus' value='true'> </td>
							</tr>	
							
							<tr>
								<td colspan = 7> &nbsp; </td>
								<td align=right><input name='okAddNewUserButton' type='submit' value='ADD'></td>
							</tr>				

						</table>
						</form> ";	
?>


<?PHP echo $informtable  ;
echo $addNewUserForm ;
?>